package com.ft.oa.web.presalesController;

import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.domain.industrys.IndustryContributor;
import com.ft.oa.domain.industrys.IndustryCustomerRelation;
import com.ft.oa.service.industryService.IIndustryCustomerRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("/target")
public class IndustryCustomerController {
    @Autowired
    private IIndustryCustomerRelationService iIndustryCustomerRelationService;
    /**
     *  获取行业目标人
     */
    @GetMapping("/targetpeople")
    public ApiResult targetpeople(@RequestParam int industryid, String industryName){
        HashMap<String,Object> participantsMap = new HashMap<>();
        participantsMap.put("targetpeopleDatas",iIndustryCustomerRelationService.targetpeople(industryid,industryName));
        return ApiResult.builder().code(200).msg("行业目标人返回成功").data(participantsMap).build();
    }
    /**
     * 删除行业目标人
     */
    @GetMapping("/delltargetpeople")
    public ApiResult delltargetpeople(@RequestParam String targetpeopleid){
        return ApiResult.builder().code(200).msg("行业目标人删除成功").data(iIndustryCustomerRelationService.delltargetpeople(targetpeopleid)).build();
    }
    /**
     * 新增目标人
     */
    @PostMapping("/addtargetpeople")
    public ApiResult addtargetpeople(@RequestBody IndustryCustomerRelation industryCustomerRelation){
        return ApiResult.builder().code(200).msg("新增行业目标人").data(iIndustryCustomerRelationService.addtargetpeople(industryCustomerRelation)).build();
    }
}
